package com.atguigu.tx;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import java.util.UUID;

/**
 * Program Name: spring-annotation
 * Created by yanlp on 2022-03-30
 *
 * @author yanlp
 * @version 1.0
 */
@Repository
public class UserDao {
    @Autowired
    private JdbcTemplate jdbcTemplate;


    public void insert() {
        String sql = "INSERT INTO tbl_user ( username, age ) VALUES (?, ? )";
        String username = UUID.randomUUID().toString().substring(0, 5);
        int age = 19;
        jdbcTemplate.update(sql, username, age);
    }


}
